home *** CD-ROM | disk | FTP | other *** search
- --------------------------------------------------
- -- Created By: Petar
- -- Description: Rear Idle Behaviour
- --------------------------
-
-
- AIBehaviour.MutantRearIdle = {
- Name = "MutantRearIdle",
-
- ---------------------------------------------
- OnActivate = function( self, entity )
- -- called when enemy receives an activate event (from a trigger, for example)
- end,
- ---------------------------------------------
- OnNoTarget = function( self, entity )
- -- called when the enemy stops having an attention target
- end,
- ---------------------------------------------
- OnPlayerSeen = function( self, entity, fDistance )
- -- called when the enemy sees a living player
- if (fDistance < 10) then
- entity:SelectPipe(0,"m_c_rush_target");
- else
- -- ranged attacks
-
- if (AI:GetGroupCount(entity.id)>1) then
- entity:SelectPipe(0,"mutant_monkey_attack");
- else
- local rnd = random(1,10);
- if (rnd<5) then
- entity:SelectPipe(0,"mutant_refract_attack");
- else
- entity:SelectPipe(0,"mutant_refract_sneak");
- end
- end
- end
- end,
- ---------------------------------------------
- OnEnemyMemory = function( self, entity )
- end,
- ---------------------------------------------
- OnInterestingSoundHeard = function( self, entity )
- -- called when the enemy hears an interesting sound
- entity:SelectPipe(0,"rear_attentive"); -- in PipeManagerShared.lua
- entity:InsertSubpipe(0,"DropBeaconAt"); -- in PipeManagerShared.lua
- end,
- ---------------------------------------------
- OnThreateningSoundHeard = function( self, entity )
- -- called when the enemy hears a scary sound
- entity:SelectPipe(0,"rear_disturbed"); -- in PipeManagerShared.lua
- entity:InsertSubpipe(0,"DropBeaconAt"); -- in PipeManagerShared.lua
- end,
- ---------------------------------------------
- OnReload = function( self, entity )
- -- called when the enemy goes into automatic reload after its clip is empty
- end,
- --------------------------------------------------
- OnNoHidingPlace = function( self, entity, sender )
- -- called when no hiding place can be found with the specified parameters
- end,
- ---------------------------------------------
- OnBulletRain = function ( self, entity, sender)
-
- -- DO NOT TOUCH THIS READIBILITY SIGNAL ------------------------
- AI:Signal(SIGNALID_READIBILITY, 2, "GETTING_SHOT_AT",entity.id);
- ----------------------------------------------------------------
-
- AI:Signal(SIGNALFILTER_GROUPONLY, 1, "INCOMING_FIRE",entity.id);
-
- -- Make this guy alerted
- entity:MakeAlerted();
-
- entity:SelectPipe(0,"rear_crouchlook");
- end,
- ---------------------------------------------
- OnReceivingDamage = function ( self, entity, sender)
-
- -- DO NOT TOUCH THIS READIBILITY SIGNAL ------------------------
- AI:Signal(SIGNALID_READIBILITY, 1, "GETTING_SHOT_AT",entity.id);
- ----------------------------------------------------------------
-
- AI:Signal(SIGNALFILTER_GROUPONLY, 1, "INCOMING_FIRE",entity.id);
-
- -- Make this guy alerted
- entity:MakeAlerted();
-
- -- the character will go into UnderFire behaviour after this function
- entity:SelectPipe(0,"rear_crouchlook");
- end,
- --------------------------------------------------
- OnGrenadeSeen = function( self, entity, fDistance )
- -- called when the enemy sees a grenade
- --System:LogToConsole("+++++++++++++++++++++++++++OnGrenadeSeen");
- entity:InsertSubpipe(0,"grenade_run_away");
- end,
- --------------------------------------------------
- -- CUSTOM SIGNALS
- --------------------------------------------------
- DEATH_CONFIRMED = function (self, entity, sender)
- --System:LogToConsole(entity:GetName().." recieved DEATH_CONFIRMED command in CoverAlert");
- entity:SelectPipe(0,"ChooseManner");
- end,
- --------------------------------------------------
- TRY_TO_LOCATE_SOURCE = function (self, entity, sender)
- -- called from "randomhide"
- entity:SelectPipe(0,"rear_lookaround_threatened");
- end,
- ---------------------------------------------
- ChooseManner = function (self, entity, sender)
- --System:LogToConsole("### ChooseManner ###");
- local XRandom = random(1,3);
- if (XRandom == 1) then
- entity:InsertSubpipe(0,"LookForThreat");
- elseif (XRandom == 2) then
- entity:InsertSubpipe(0,"RandomSearch");
- elseif (XRandom == 3) then
- entity:InsertSubpipe(0,"ApproachDeadBeacon");
- end
- end,
- ---------------------------------------------
- OnGroupMemberDied = function( self, entity, sender)
- -- called when a member of the group dies
- --System:LogToConsole(entity:GetName().." recieved OnGroupMemberDied signal in RearIdle");
-
- entity:MakeAlerted();
-
- if (sender.Properties.groupid == entity.Properties.groupid) then
- if (entity ~= sender) then
- entity:SelectPipe(0,"TeamMemberDiedLook");
- end
- else
- entity:SelectPipe(0,"randomhide");
- end
- end,
- --------------------------------------------------
- OnGroupMemberDiedNearest = function ( self, entity, sender)
- --System:LogToConsole(entity:GetName().." recieved OnGroupMemberDiedNearest signal in CoverIdle");
-
- entity:MakeAlerted();
-
- -- DO NOT TOUCH THIS READIBILITY SIGNAL ---------------------------
- AI:Signal(SIGNALID_READIBILITY, 1, "FRIEND_DEATH",entity.id);
- -------------------------------------------------------------------
-
- -- bounce the dead friend notification to the group (you are going to investigate it)
- AI:Signal(SIGNALFILTER_SPECIESONLY, 1, "OnGroupMemberDied",entity.id);
-
- -- investigate corpse
- entity:SelectPipe(0,"RecogCorpse",sender.id);
- end,
- --------------------------------------------------
- ----------------- GROUP SIGNALS ------------------
- --------------------------------------------------
- HEADS_UP_GUYS = function (self, entity, sender)
- if (entity ~= sender) then
- entity:MakeAlerted();
- entity:SelectPipe(0,"rear_headup");
- end
- end,
- ---------------------------------------------
- INCOMING_FIRE = function (self, entity, sender)
- if (entity ~= sender) then
- entity:SelectPipe(0,"randomhide");
- entity:InsertSubpipe(0,"look_in_direction_of",sender.id);
- end
- end,
- ---------------------------------------------
- OnCoverRequested = function ( self, entity, sender)
- -- called when cover is requested
- end,
- ------------------------------------------------------------------------
- ------------------------------ Animation -------------------------------
- PlayGetDownAnim = function (self, entity, sender)
- entity:StartAnimation(0,"pgetdown",0);
- end,
- ------------------------------------------------------------------------
- PlayGetUpAnim = function (self, entity, sender)
- entity:StartAnimation(0,"pgetup",0);
- end,
- ------------------------------------------------------------------------
- }